package interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import entity.User;

public class SysInterceptor extends HandlerInterceptorAdapter {

	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
	        throws Exception {
		User user=(User)request.getSession().getAttribute("user");
		if(user==null){
			response.sendRedirect("../html/login.jsp");
			return false;
		}
			return true;
	    }
}
